#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from inary.actionsapi import autotools
from inary.actionsapi import shelltools
from inary.actionsapi import inarytools
from inary.actionsapi import get

def setup():
    autotools.configure("--prefix=/usr --with-readline")
    open("bc/fix-libmath_h","w").write("""
    #! /bin/bash
    sed -e '1   s/^/{"/' \
        -e     's/$/",/' \
        -e '2,$ s/^/"/'  \
        -e   '$ d'       \
        -i libmath.h

    sed -e '$ s/$/0}/' \
        -i libmath.h
    """)

def build():
    shelltools.system("make -j1")

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())
